<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>AutoHotkey_L New Features</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="static/theme.css" rel="stylesheet" type="text/css" />
<script src="static/content.js" type="text/javascript"></script>
</head>
<body><h1>AutoHotkey_L New Features</h1>

<p>This document describes features added in the AutoHotkey_L branch of AutoHotkey development, now simply known as "AutoHotkey 1.1".</p>
<p><strong>Caution:</strong> This document has been neglected in recent years and may be missing some of the more recent changes.</p>

<br><table class="info">

<tr><th id="flow">Control Flow</th><th>&nbsp;</th></tr>
<tr><td><a href="commands/Break.htm">Break <i>LoopLabel</i></a></td><td>Break out of a loop or any number of nested loops.</td></tr>
<tr><td><a href="commands/Continue.htm">Continue <i>LoopLabel</i></a></td><td>Continue a loop, even from within any number of nested loops.</td></tr>
<tr><td><a href="commands/For.htm">For <i>x</i>,<i>y</i> in <i>z</i></a></td><td>Loop through the contents of an object.</td></tr>
<tr><td><a href="commands/Until.htm">Loop Until</a></td><td>Loop until a condition is true. Applicable to any type of Loop.</td></tr>
<tr><td><a href="commands/Try.htm">Try</a>...<a href="commands/Catch.htm">Catch</a>...<a href="commands/Finally.htm">Finally</a></td><td>Provides structured exception handling.</td></tr>
<tr><td><a href="commands/Throw.htm">Throw</a></td><td>Throws an exception.</td></tr>

<tr><th id="commands">Commands</th><th>&nbsp;</th></tr>
<tr><td><a href="commands/FileEncoding.htm">FileEncoding</a></td><td>Sets the default encoding for <a href="commands/FileRead.htm">FileRead</a>, <a href="commands/FileReadLine.htm">FileReadLine</a>, <a href="commands/LoopReadFile.htm">Loop Read</a>, <a href="commands/FileAppend.htm">FileAppend</a>, and <a href="commands/FileOpen.htm">FileOpen</a>.<br><i>See also:</i> <a href="#enc">Text Encodings</a></td></tr>
<tr><td><a href="commands/Gui.htm">Gui</a></td><td>See <a href="#GUI_Enhancements">GUI Enhancements</a> below.</td></tr>
<tr><td><a href="commands/IniRead.htm">IniRead</a>/<a href="commands/IniWrite.htm">Write</a>/<a href="commands/IniDelete.htm">Delete</a></td><td>Read, write or delete entire sections, or retrieve a list of all section names.</td></tr>
<tr><td><a href="commands/Menu.htm#MenuIcon">Menu, Icon</a></td><td>Sets or removes a menu item's icon.</td></tr>
<tr><td><a href="commands/Run.htm">Run</a></td><td><a href="Compat.htm#Run">Improvements</a> were made to the way parameters are parsed.</tr>
<tr><td><a href="commands/Send.htm#Unicode">SendInput {U+nnnn}</a></td><td>Sends a Unicode character. Unicode characters may be used directly in Unicode builds.</td></tr>
<tr><td><a href="commands/SendLevel.htm">SendLevel</a></td><td>Controls which artificial keyboard and mouse events are ignored by hotkeys and hotstrings.</td></tr>
<tr><td><a href="commands/SetFormat.htm">SetFormat, IntegerFast, h|H</a></td><td>Set lower-case or upper-case hexadecimal format.</td></tr>
<tr><td><a href="commands/SetRegView.htm">SetRegView, RegView</a></td><td>Allows registry commands in a 32-bit script to access the 64-bit registry view and vice versa.</td></tr>
<tr><td><a href="commands/Transform.htm#HTML">Transform, HTML</a></td><td>Perform code page or HTML transformations.</td></tr>
<tr><td><a href="commands/WinGet.htm#ProcessPath">WinGet, ..., ProcessPath</a></td><td>Retrieves the full path and name of the process that owns a given window.</td></tr>

<tr><th id="directives">Directives</th><th>&nbsp;</th></tr>
<tr><td><a href="commands/_If.htm">#If <i>expression</i></a></td><td>Similar to <a href="commands/_IfWinActive.htm">#IfWinActive</a>, but for arbitrary expressions.</td></tr>
<tr><td><a href="commands/_IfTimeout.htm">#IfTimeout</a></td><td>Sets the maximum time that may be spent evaluating a single #If  expression.</td></tr>
<tr><td><a href="commands/_MenuMaskKey.htm">#MenuMaskKey</a></td><td>Changes which key is used to mask Win or Alt keyup events.</td></tr>
<tr><td><a href="commands/_Include.htm">#Include &lt;Lib&gt;</a></td><td>Includes a script file from a function library folder.</td></tr>
<tr><td><a href="commands/_InputLevel.htm">#InputLevel</a></td><td>Controls which artificial keyboard and mouse events are ignored by hotkeys and hotstrings.</td></tr>
<tr><td><a href="commands/_Warn.htm">#Warn</a></td><td>Enables or disables warnings for selected conditions that may be indicative of developer errors.</td></tr>

<tr><th id="functions">Functions</th><th>&nbsp;</th></tr>
<tr><td><a href="commands/ComObjActive.htm">ComObj...</a> --<br>ComObjActive<br>ComObjEnwrap/Unwrap<br>ComObjParameter<br>ComObjType</td><td><br>Retrieves a registered COM object.<br>Wraps/unwraps a COM object.<br>Wraps a value and type to pass as a parameter.<br>Retrieves a COM object's type information.</td></tr>
<tr><td><a href="commands/ComObjArray.htm">ComObjArray</a></td><td>Creates a SAFEARRAY for use with COM.</td></tr>
<tr><td><a href="commands/ComObjConnect.htm">ComObjConnect</a></td><td>Connects a COM object's event sources to functions with a given prefix.</td></tr>
<tr><td><a href="commands/ComObjCreate.htm">ComObjCreate</a></td><td>Creates a COM object.</td></tr>
<tr><td><a href="commands/ComObjError.htm">ComObjError</a></td><td>Enables or disables notification of COM errors.</td></tr>
<tr><td><a href="commands/ComObjFlags.htm">ComObjFlags</a></td><td>Retrieves or changes flags which control a COM wrapper object's behaviour.</td></tr>
<tr><td><a href="commands/ComObjGet.htm">ComObjGet</a></td><td>Returns a reference to an object provided by a COM component.</td></tr>
<tr><td><a href="commands/ComObjQuery.htm">ComObjQuery</a></td><td>Queries a COM object for an interface or service.</td></tr>
<tr><td><a href="commands/ComObjType.htm">ComObjType</a></td><td>Retrieves type information from a COM object.</td></tr>
<tr><td><a href="commands/ComObjValue.htm">ComObjValue</a></td><td>Retrieves the value or pointer stored in a COM wrapper object.</td></tr>
<tr><td><a href="commands/Throw.htm#Exception">Exception</a></td><td>Creates an exception object for <a href="commands/Throw.htm">Throw</a> (also provides limited access to the call stack).</td></tr>
<tr><td><a href="commands/FileOpen.htm">FileOpen</a></td><td>Provides object-oriented file I/O.</td></tr>
<tr><td><a href="Functions.htm#Func">Func</a></td><td>Retrieves a <a href="Objects.htm#Function_References">reference</a> to a function.</td></tr>
<tr><td><a href="Functions.htm#GetKeyName">GetKeyName/VK/SC</a></td><td>Retrieves the name or text, virtual key code or scan code of a key.</td></tr>
<tr><td><a href="Functions.htm#InStr">InStr</a></td><td>Searches for a given <em>occurrence</em> of a string, from the left or the right.</td></tr>
<tr><td><a href="Functions.htm#IsByRef">IsByRef</a></td><td>Determines whether a ByRef parameter was supplied with a variable.</td></tr>
<tr><td><a href="Objects.htm">IsObject</a></td><td>Determines whether a value is an object.</td></tr>
<tr><td><a href="commands/StrPutGet.htm">StrPut / StrGet</a></td><td>Copies a string to or from a memory address, optional converting it between code pages.</td></tr>
<tr><td><a href="commands/Trim.htm">Trim</a></td><td>Trims certain characters from the beginning and/or end of a string.</td></tr>
<tr><td><a href="misc/RegExCallout.htm">RegEx (?C<i>Num</i>:<i>Func</i>)</a></td><td>Calls a function during evaluation of a regex pattern.</td></tr>
<tr><td><a href="#Function_Libraries">Function Libraries</a></td><td>New &quot;local library&quot; and <code>#Include &lt;LibName&gt;</code>.</td></tr>
<tr><td><a href="Functions.htm#Variadic">Variadic Functions</a></td><td>Functions may accept a variable number of parameters via an array.</td></tr>
<tr><td><a href="#Static">Static Initializers</a></td><td>Static variables can now be initialized using any expression.</td></tr>

<tr><th id="objects">Objects</th><th>&nbsp;</th></tr>
<tr><td><a href="Objects.htm">General</a></td><td>Behaviour and usage of objects in general.</td></tr>
<tr><td><a href="Objects.htm#Arrays">Object</a></td><td>Associative arrays which can be extended with other functionality.</td></tr>
<tr><td><a href="objects/Enumerator.htm">Enumerator</a></td><td>Allows items in a collection to be enumerated.</td></tr>
<tr><td><a href="objects/File.htm">File</a></td><td>Provides an interface to access a file.  <a href="commands/FileOpen.htm">FileOpen</a> returns an object of this type.</td></tr>
<tr><td><a href="objects/Func.htm">Func</a></td><td>Represents a user-defined or built-in function which can be called by the script.</td></tr>
<tr><td>ComObject</td><td>See ComObj functions above.</td></tr>

<tr><th id="vars">Variables</th><th>&nbsp;</th></tr>
<tr><td>A_Is64bitOS</td><td>Contains 1 (true) if the OS is 64-bit or 0 (false) if it is 32-bit.</td></tr>
<tr><td>A_IsUnicode</td><td>In Unicode builds, this variable contains 1 (<i>true</i>).  In ANSI builds it is not defined, so is effectively <i>false</i>.</td></tr>
<tr><td>A_FileEncoding</td><td>Contains the default encoding for various commands; see <a href="commands/FileEncoding.htm">FileEncoding</a>.</td></tr>
<tr><td>A_OSVersion</td><td>Supports Windows 7 and Windows 8; see <a href="Variables.htm#OSVersion">A_OSVersion</a>.</td></tr>
<tr><td>A_PriorKey</td><td>The name of the last key which was pressed prior to the most recent key-press or key-release ... <a href="Variables.htm#PriorKey">(More)</a></td></tr>
<tr><td>A_PtrSize</td><td>Contains the size of a pointer, in bytes. This is either 4 (32-bit) or 8 (64-bit).</td></tr>
<tr><td>A_RegView</td><td>The current registry view as set by <a href="commands/SetRegView.htm">SetRegView</a>.</td></tr>
<tr><td>A_ScriptHwnd</td><td>The unique ID (HWND/handle) of the script's hidden main window.</td></tr>

<tr><th id="types">Datatypes</th><th>&nbsp;</th></tr>
<tr><td><a href="commands/DllCall.htm#ptr">Ptr</a></td><td>Equivalent to <i>Int</i> in 32-bit builds and <i>Int64</i> in 64-bit builds. Supported by <a href="commands/DllCall.htm">DllCall</a>, <a href="commands/NumPut.htm">NumPut</a> and <a href="commands/NumGet.htm">NumGet</a>.</td></tr>
<tr><td><a href="commands/DllCall.htm#astr">AStr</a>, <a href="commands/DllCall.htm#wstr">WStr</a></td><td>Supported only by <a href="commands/DllCall.htm">DllCall</a>; see <a href="Compat.htm">Script Compatibility</a>.</td></tr>

<tr><th id="unicode">Unicode</th><th>&nbsp;</th></tr>
<tr><td><a href="Compat.htm">Compatibility</a></td><td>How to deal with Unicode in DllCall, etc.</td></tr>
<tr><td><a href="Scripts.htm#cp">Script Files</a></td><td>Using Unicode in script files.</td></tr>
<tr><td><a href="commands/Send.htm#Unicode">SendInput</a></td><td>Using Unicode with SendInput.</td></tr>

<tr><th id="other">Other</th><th>&nbsp;</th></tr>
<tr><td><a href="misc/WinTitle.htm#ahk_exe">ahk_exe</a></td><td>Windows can be identified by the name or path of the process (EXE file) which owns them.</td></tr>
<tr><td><a href="Scripts.htm#idebug">Debugging</a></td><td>Interactive debugging features (line by line execution etc.).</td></tr>
<tr><td><a href="#Error_Handling">Error Handling</a></td><td>Try/catch/throw and increased usefulness for A_LastError.</td></tr>
<tr><td><a href="#GUI_Enhancements">GUI Enhancements</a></td><td>Various enhancements to the Gui command and related.</td></tr>
<tr><td><a href="#icons">Icon Support</a></td><td>Resource identifiers and improved support for various icon sizes.</td></tr>
<tr><td><a href="Compat.htm">Other Changes</a></td><td>Changes affecting script compatibility.</td></tr>
<tr><td><a href="AHKL_ChangeLog.htm">Version History</a></td><td>History of AutoHotkey_L revisions.</td></tr>

</table>


<h2 id="Error_Handling">Error Handling</h2>
<p>Many commands support using <a href="commands/Try.htm">try</a>/<a href="commands/Catch.htm">catch</a> instead of ErrorLevel for error handling. For example:</p>
<pre class="NoIndent">try
{
    FileCopy, file1.txt, C:\folder
    FileDelete, C:\folder\old.txt
}
catch
    MsgBox An error occured!</pre>
<p>Additionally, the following commands now set <a href="Variables.htm#LastError">A_LastError</a> to assist with debugging: FileAppend, FileRead, FileReadLine, FileDelete, FileCopy, FileMove, FileGetAttrib/Time/Size/Version, FileSetAttrib/Time, FileCreateDir, RegRead, RegWrite, RegDelete.</p>

<h2 id="Function_Libraries">Function Libraries</h2>
<p>In addition to the user library in <code>%A_MyDocuments%\AutoHotkey\Lib</code> and standard library in the AutoHotkey directory, functions may be auto-included from the &quot;local library&quot; which resides in <code>%A_ScriptDir%\Lib</code>. For more information, see <a href="Functions.htm#lib">Libraries of Functions</a>.</p>
<p><a href="commands/_Include.htm">#Include &lt;LibName&gt;</a> explicitly includes a library file which may be located in any one of the function libraries.</p>

<h2 id="GUI_Enhancements">GUI Enhancements</h2>
<p>A number of enhancements have been made to the <a href="commands/Gui.htm">Gui</a> command and related:</p>
<ul>
  <li>A <a href="commands/Gui.htm#MultiWin">name or HWND</a> can be used instead of a number between 1 and 99 when referring to a GUI.</li>
  <li><a href="commands/Gui.htm#New">Gui, New</a> creates a new anonymous GUI.</li>
  <li>Any number of named or anonymous GUIs can be created.</li>
  <li>New GUI options: <a href="commands/Gui.htm#GuiHwndOutputVar">+Hwnd<em>OutputVar</em></a>, <a href="commands/Gui.htm#Parent">+Parent<em>GUI</em></a></li>
  <li>A GUI's owner can be any arbitrary window: <a href="commands/Gui.htm#Owner">+Owner<em>%HWND%</em></a>.</li>
  <li><a href="commands/Gui.htm#fontq">Gui, Font</a> can control anti-aliasing of text.</li>
  <li><a href="commands/GuiControls.htm#ActiveX">ActiveX controls</a> such as the Internet Explorer WebBrowser control are supported.</li>
  <li><a href="commands/GuiControlGet.htm#Name">GuiControlGet, <em>OutputVar</em>, Name</a> gets the name of the variable associated with a GUI control.</li>
  <li>Keyboard accelerators such as Ctrl+O are supported automatically when used in <a href="commands/Gui.htm#Menu">Gui menus</a>.</li>
  <li><a href="commands/Gui.htm#fontq">Font quality</a> can be controlled by the Font sub-command.</li>
</ul>

<h2 id="Static">Static Variables</h2>
<p>Static variables can now be initialized using any expression. For example:</p>
<pre>Sleep 500
MsgBox % Time() &quot;ms since the script started.&quot;
Time() {
    static Tick := A_TickCount
    return A_TickCount - Tick
}</pre>

<h2 id="enc">Text Encodings</h2>
<p><a href="commands/FileRead.htm">FileRead</a>, <a href="commands/FileReadLine.htm">FileReadLine</a>, <a href="commands/LoopReadFile.htm">Loop Read</a> and <a href="commands/FileAppend.htm">FileAppend</a> support the majority of Windows-supported text encodings, not just the system default ANSI code page.  <a href="commands/FileEncoding.htm">FileEncoding</a> can be used to set the default encoding, which can be overridden for FileRead and FileAppend as follows:</p>
<pre class="Syntax">FileRead, OutputVar, *P<i>nnn</i> Filename
FileAppend [, Text, Filename, Encoding]</pre>
<p>While <i>nnn</i> must be a numeric <a href="http://msdn.microsoft.com/en-us/library/dd317756.aspx">code page identifier</a>, <i>Encoding</i> follows the same format as <a href="commands/FileEncoding.htm">FileEncoding</a>.</p>
<p><b>See also:</b> <a href="Compat.htm#FileRead">Script Compatibility</a></p>

<h2 id="Variadic">Variadic Functions and Function-Calls</h2>
<p><a href="Functions.htm#Variadic">Variadic functions</a> can receive a variable number of parameters via an array, while <a href="Functions.htm#VariadicCall">variadic function-calls</a> can be used to pass a variable number of parameters to a function.</p>


<h2 id="icons">Improvements to Icon Support</h2>

<h3>Unusual Sizes</h3>
<p>Icon resources of any size supported by the operating system may be extracted from executable files.  When multiple sized icon resources exist within an icon group, the most appropriate size is used.  Prior to revision 17, an arbitrary icon resource was selected by the system, scaled to the system large icon size, then scaled back to the requested size.</p>

<h3>Resource Identifiers</h3>
<p>Negative icon numbers may be used to identify a group icon resource within an executable file. For example, the following sets the tray icon to the default icon used by ahk files:</p>
<pre>Menu, Tray, Icon, %A_AhkPath%, -160</pre>

</body></html>
